package liangtWorkSpace.strategy.comparableFile;

/**
 * @ClassName Dog
 * @Description : 功能说明
 * @Author : LiangT
 * @Date : 2020/4/10 17:58
 */
public class Dog implements Comparable<Dog> {
   public int food;

    @Override
    public String toString() {
        return "Dog{" +
                "food=" + food +
                '}';
    }

    public Dog(int food) {
        this.food = food;
    }

    @Override
    public int comparetTo(Dog o) {
        Dog dog = o;
        if (this.food < dog.food) return -1;
        else if (this.food > dog.food)return 1;
        else return 0;
    }
}
